#ifndef APPLICATION_H
#define APPLICATION_H

#include "Singleton.h"
#include "hge.h"
#include "hgeResource.h"
#include "StateManager.h"

class RenderWindow;
class GeneticsEngine;

class Application : public Singleton<Application>
{
public:
	Application();
	virtual ~Application();

	bool Setup(char* a_pWindowName, int a_width, int a_height);
	void Execute();

	void Cleanup();
	void RegisterStateManager(StateManager* a_pStateManager);

	HGE* GetHGE() const;
	StateManager* GetStateManager() const;
	hgeResourceManager* GetResourceManager() const;
	GeneticsEngine* GetGeneticsEngine() const;
	RenderWindow* GetWindow() const;

	int GetWidth() const;
	int GetHeight() const;

private:
	static bool FrameFunc();
	static bool RenderFunc();

	bool Initialize();

	static std::auto_ptr<Application> s_pApplication;

	HGE* m_pHGE;
	StateManager* m_pStateManager;
	hgeResourceManager* m_pResourceManager;
	RenderWindow* m_pWindow;

	int m_width;
	int m_height;
};

#endif //APPLICATION_H